import React from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import * as sortActions from '../../actions/sort'

export function connectSort(Component) {
	class WrapComp extends React.Component {
		render() {
			return (
				<div><Component {...this.props} /></div>
			);
		}
	}
	 const mapStateToProps = (state) => ({
   		sort: {
			sortsFetched: state.sort.sortsFetched,
			sortsData: state.sort.sortsData,
			goodsFetched: state.sort.goodsFetched,
			goodsData: state.sort.goodsData
		}
  	});
  	const mapDispatchToProps = (dispatch) => ({
		sortActions: bindActionCreators(sortActions, dispatch)
  	});
	return connect(mapStateToProps, mapDispatchToProps)(WrapComp);
}